package it.slothy.noveleditor.classes.elements;

import it.slothy.noveleditor.enumaration.VNEnumStory;

import java.util.EnumMap;
import java.util.HashMap;

public abstract class VNStory extends VNElement {
	
	//Struttura Dati
	public static EnumMap<VNEnumStory, HashMap<String, VNStory>> stories = new EnumMap<VNEnumStory, HashMap<String, VNStory>>(VNEnumStory.class);

	protected String name;
	protected VNEnumStory enumSTR;
	
	public VNStory(VNEnumStory e, String n){
		//Setto il name e carico il prossimo ID disponibile nella lista
		super();
		this.name = n;
		this.enumSTR = e;
		
		//this.id = this.getValidID();
		
		//Addo all'archivio dei VNObjects
		stories.get(this.enumSTR).put(name, this);
	}

	@Override
	protected int getValidID() {
		int valid = 0;
		/*ArrayList<VNStory> st = stories.get(enumSTR);
		
		for(int i=0; i<st.size(); i++){
			VNStory vnObj = st.get(i);
			
			if(valid == vnObj.getId()){
				//ricomincio la ricerca
				valid++;
				i = 0;
				continue;
			}
		}*/
		
		return valid;
	}

}
